<template>
    <div>
        <van-sticky>
            <van-search v-model="value" shape="round" background="#4fc08d" placeholder="请输入搜索关键词" />
        </van-sticky>
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
            <van-swipe-item v-for="(item, index) in arr" :key="index">
                <img :src="item.image_src" />
            </van-swipe-item>
        </van-swipe>
        <van-grid :column-num="4">
            <van-grid-item v-for="(item, index) in brr" :key="index" :icon="item.image_src" :text="item.name" />
        </van-grid>
        <van-card num="2" price="2.00" desc="描述信息" title="商品标题"
            thumb="https://api-hmugo-web.itheima.net/pyg/pic_floor01_1@2x.png" />
        <van-card num="2" price="2.00" desc="描述信息" title="商品标题"
            thumb="https://api-hmugo-web.itheima.net/pyg/pic_floor01_1@2x.png" />
        <van-card num="2" price="2.00" desc="描述信息" title="商品标题"
            thumb="https://api-hmugo-web.itheima.net/pyg/pic_floor01_1@2x.png" />
        <van-card num="2" price="2.00" desc="描述信息" title="商品标题"
            thumb="https://api-hmugo-web.itheima.net/pyg/pic_floor01_1@2x.png" />
        <van-card num="2" price="2.00" desc="描述信息" title="商品标题"
            thumb="https://api-hmugo-web.itheima.net/pyg/pic_floor01_1@2x.png" />
        <van-card num="2" price="2.00" desc="描述信息" title="商品标题"
            thumb="https://api-hmugo-web.itheima.net/pyg/pic_floor01_1@2x.png" />
        <van-card num="2" price="2.00" desc="描述信息" title="商品标题"
            thumb="https://api-hmugo-web.itheima.net/pyg/pic_floor01_1@2x.png" />
    </div>
</template>

<script setup>
import axios from 'axios';
import { ref } from 'vue';
let arr = ref([])
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata').then(res => {
    arr.value = res.data.message
})
let brr = ref([])
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/home/catitems').then(res => {
    brr.value = res.data.message
})
let crr = ref([])
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/home/floordata').then(res => {
    crr.value = res.data.message
})
</script>

<style>
.my-swipe .van-swipe-item {
    width: 400px;
    height: 200px;
}

img {
    width: 400px;
    height: 200px;
}
</style>